<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="./../assets/css/combined.css">
	<link rel="shortcut icon" href="./../favicon.ico" />
	<script src="http://www.google.com/jsapi" type="text/javascript"></script>
	<script type="text/javascript">
		var path = './../';
		var class_prefix = "Html::";
	</script>
	<script src="./../assets/js/combined.js"></script>
	<title>Html - Classes - FuelPHP Documentation</title>
</head>
<body>
	<div id="container">
		<header id="header">
			<div class="table">
				<h1>
					<strong>FuelPHP, a PHP 5.3 Framework</strong>
					Documentation
				</h1>

				<form id="google_search">
					<p>
						<span id="search_clear">&nbsp;</span>
						<input type="submit" name="search_submit" id="search_submit" value="search" />
						<input type="text" value="" id="search_input" name="search_input" />
					</p>
				</form>
			</div>
			<nav>

				<div class="clear"></div>
			</nav>
			<a href="#" id="toc_handle">table of contents</a>
			<div class="clear"></div>
		</header>

		<div id="cse">
			<div id="cse_point"></div>
			<div id="cse_content"></div>
		</div>

		<div id="main">

			<h2>Html Class</h2>

			<p>The Html class is an HTML wrapper for nearly all HTML tags.</p>

			<h3>Doctypes</h3>

			<p>We have included a configuration file located at <kbd>fuel/core/config/doctypes.php</kbd> which has all the doctypes.</p>

			<article>
				<h4 class="method" id="method_anchor">anchor($href, $text, $attributes = array(), $secure = null)</h4>
				<p>The <strong>anchor</strong> method returns an HTML anchor tag.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$href</kbd></th>
									<td><i>required</i></td>
									<td>Target url</td>
								</tr>
								<tr>
									<th><kbd>$text</kbd></th>
									<td><i>required</i></td>
									<td>Anchor value</td>
								</tr>
								<tr>
									<th><kbd>$attributes</kbd></th>
									<td><strong>false</strong></td>
									<td>Array of attributes to be applied to the anchor tag.</td>
								</tr>
								<tr>
									<th><kbd>$secure</kbd></th>
									<td><i>null</i></td>
									<td>Set to false to force http, or to true to force https on the created URL</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>String containing the correctly formatted anchor tag (and attributes if supplied).</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>//returns &lt;a href="http://www.domain.com/example"&gt;Example&lt;/a&gt;
echo Html::anchor('example', 'Example');

//returns &lt;a href="http://www.otherdomain.com/example"&gt;Example&lt;/a&gt;
echo Html::anchor('http://www.otherdomain.com/example', 'Example');

//returns &lt;a href="http://www.domain.com/example" id="a1" class="sample" style="color:red;"&gt;Example&lt;/a&gt;
echo Html::anchor('example', 'Example', array('id' => 'a1', 'class' => 'sample', 'style' => 'color:red'));

//returns &lt;a href="https://www.domain.com/example" id="a1" class="sample" style="color:red;"&gt;Example&lt;/a&gt;
echo Html::anchor('example', 'Example', array('id' => 'a1', 'class' => 'sample', 'style' => 'color:red'), true);</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 class="method" id="method_mail_to">mail_to($email, $text, $subject = null, $attr = array())</h4>
				<p>The <strong>mail_to</strong> method returns an HTML anchor tag with mailto as the target.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$email</kbd></th>
									<td><i>required</i></td>
									<td>Email address</td>
								</tr>
								<tr>
									<th><kbd>$text</kbd></th>
									<td><i>required</i></td>
									<td>Anchor value</td>
								</tr>
								<tr>
									<th><kbd>$subject</kbd></th>
									<td><strong>null</strong></td>
									<td>Anchor value</td>
								</tr>
								<tr>
									<th><kbd>$attr</kbd></th>
									<td><strong>empty</strong></td>
									<td>Array of attributes to be applied to the anchor tag.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>String containing the correctly formated anchor tag (and attributes if supplied).</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>//returns &lt;a href="mailto:name@domain.com"&gt;Name&lt;/a&gt;
echo Html::mail_to('name@domain.com', 'Name');

//returns &lt;a href="mailto:name@domain.com?subject=Something"&gt;Name&lt;/a&gt;
echo Html::mail_to('name@domain.com', 'Name', 'Something');

//returns &lt;a href="mailto:name@domain.com" id="a2" class="sample" style="color:red;"&gt;Name&lt;/a&gt;
echo Html:::mail_to('name@domain.com', 'Name', null, array('id' => 'a2', 'class' => 'sample', 'style' => 'color:red'));</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 class="method" id="method_mail_to_safe">mail_to_safe($email, $text, $subject = null, $attr = array())</h4>
				<p>The <strong>mail_to_safe</strong> method returns JavaScript code that produces an HTML anchor tag with mailto as target.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$email</kbd></th>
									<td><i>required</i></td>
									<td>Email address</td>
								</tr>
								<tr>
									<th><kbd>$text</kbd></th>
									<td><i>required</i></td>
									<td>Anchor value</td>
								</tr>
								<tr>
									<th><kbd>$subject</kbd></th>
									<td><strong>null</strong></td>
									<td>Anchor value</td>
								</tr>
								<tr>
									<th><kbd>$attr</kbd></th>
									<td><strong>empty</strong></td>
									<td>Array of attributes to be applied to the anchor tag.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>String containing the correctly formatted anchor tag (and attributes if supplied).</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>//returns
//&lt;script type="text/javascript"&gt;
//	var user = "name";
//	var at = "@";
//	var server = "domain.com";
//	document.write('&lt;a href="' + 'mail' + 'to:' + user + at + server + '"&gt;Name&lt;/a&gt;');
//&lt;/script&gt;
echo Html::mail_to_safe('name@domain.com', 'Name');</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 class="method" id="method_img">img($src, $attr = array())</h4>
				<p>The <strong>img</strong> method returns an image tag.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$src</kbd></th>
									<td><i>required</i></td>
									<td>Path to image.</td>
								</tr>
								<tr>
									<th><kbd>$attr</kbd></th>
									<td><strong>array()</strong></td>
									<td>Attributes array. If no alt attribute is supplied, the alt attribute defaults to the filename.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>String containing the correctly formatted image tag.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>//returns &lt;img src="http://example.com/path/to/image.png" alt="image.png" /&gt;
echo Html::img('path/to/image.png');

//returns &lt;img src="http://example.com/path/to/image.png" alt="Alt Message" class="myclass" /&gt;
echo Html::img('path/to/image.png', array("alt" => "Alt Message", 'class' => "myclass"));
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 class="method" id="method_meta">meta($name, $content = '', $type = 'name')</h4>
				<p>The <strong>meta</strong> method returns meta tag or tags if multi-level array is supplied.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$name</kbd></th>
									<td><i>required</i></td>
									<td>Can be array containing single or multiple meta parameters or can be name/http-equiv value.</td>
								</tr>
								<tr>
									<th><kbd>$content</kbd></th>
									<td><i>required</i></td>
									<td>If no array is supplied on the $name parameter, $content equals to the meta attribute content's value.</td>
								</tr>
								<tr>
									<th><kbd>$type</kbd></th>
									<td><strong>'name'</strong></td>
									<td>If no value is supplied will default to name. Can be name or http-equiv.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>String containing the correctly formated meta tags.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>//returns &lt;meta name="description" content="Meta Example!" /&gt;
echo Html::meta('description', 'Meta Example!');

//returns &lt;meta name="robots" content="no-cache" /&gt;
echo Html::meta('robots', 'no-cache');

$meta = array(
	array('name' => 'robots', 'content' => 'no-cache'),
	array('name' => 'description', 'content' => 'Meta Example'),
	array('name' => 'keywords', 'content' => 'fuel, rocks'),
);

//returns &lt;meta name="robots" content="no-cache" /&gt;
//returns &lt;meta name="description" content="Meta Example!" /&gt;
//returns &lt;meta name="keywords" content="fuel, rocks" /&gt;
echo Html::meta($meta);</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 class="method" id="method_doctype">doctype($type = 'xhtml1-trans')</h4>
				<p>The <strong>doctype</strong> method returns a correctly formated doctype tag.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$type</kbd></th>
									<td>'xhtml1-trans'</td>
									<td>Type of HTML doctype tag to be outputted.<br />Accepted Values: <kbd>xhtml11</kbd>, <kbd>xhtml1-strict</kbd>, <kbd>xhtml1-trans</kbd>, <kbd>xhtml1-frame</kbd>, <kbd>html5</kbd>, <kbd>html4-strict</kbd>, <kbd>html4-trans</kbd>, <kbd>html4-frame</kbd></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>String containing the correctly formated doctype tag.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>//returns the XHTML1 Transitional doctype tag.
echo Html::doctype();

//returns &lt;!DOCTYPE html&gt;
echo Html::doctype('html5');</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 class="method" id="method_audio">audio($src, $attr = false)</h4>
				<p>The <strong>audio</strong> method requires you to set html5 as the doctype in order to be used.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$src</kbd></th>
									<td><i>required</i></td>
									<td>Location of the source file or array containing multiple locations.</td>
								</tr>
								<tr>
									<th><kbd>$attr</kbd></th>
									<td><strong>false</strong></td>
									<td>Array of attributes to be applied to the audio tag.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>String containing the correctly formatted audio tag with its sources.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>//returns &lt;audio&gt;&lt;source src="../sounds/beep.mp3" /&gt;&lt;/audio&gt;
echo Html::audio('../sounds/beep.mp3');

//returns &lt;audio&gt;&lt;source src="../sounds/beep.mp3" /&gt;&lt;source src="../sounds/frog.mp4" /&gt;&lt;/audio&gt;
echo Html::audio(array('../sounds/beep.mp3','../sounds/frog.mp4'));</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 class="method" id="method_ul">ul($list, $style = false)</h4>
				<p>The <strong>ul</strong> method returns a correctly formatted single or multi-level unordered list.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$list</kbd></th>
									<td><i>required</i></td>
									<td>Array containing single or multi-level items to be outputted as list items.</td>
								</tr>
								<tr>
									<th><kbd>$style</kbd></th>
									<td><strong>false</strong></td>
									<td>Array of attributes to be applied to the ul tag.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>String containing the correctly formated list.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>/* returns
&lt;ul id="todo" class="pending"&gt;
	&lt;li&gt;red&lt;/li&gt;
	&lt;li&gt;blue&lt;/li&gt;
	&lt;li&gt;green&lt;/li&gt;
	&lt;li&gt;yellow&lt;/li&gt;
&lt;/ul&gt;
*/
$items = array('red', 'blue', 'green', 'yellow');
$attr = array('id' => 'todo','class' => 'pending');
echo Html::ul($items, $attr);

/* returns
&lt;ul class="order"&gt;
	&lt;li&gt;colors
		&lt;ul&gt;
			&lt;li&gt;blue&lt;/li&gt;
			&lt;li&gt;red&lt;/li&gt;
			&lt;li&gt;green&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;sky&lt;/li&gt;
	&lt;li&gt;tools
		&lt;ul&gt;
			&lt;li&gt;screwdriver&lt;/li&gt;
			&lt;li&gt;hammer&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;
*/
$items = array(
	'colors' => array('blue', 'red', 'green'),
	'sky',
	'tools' => array('screwdriver','hammer')
);
$attr = array('class' => 'order');
echo Html::ul($items, $attr);</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 class="method" id="method_ol">ol($list, $style = false)</h4>
				<p>The <strong>ol</strong> method returns a correctly formatted single or multi-level ordered list.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$list</kbd></th>
									<td><i>required</i></td>
									<td>Array containing single or multi-level items to be outputted as list items.</td>
								</tr>
								<tr>
									<th><kbd>$style</kbd></th>
									<td><strong>false</strong></td>
									<td>(Optional) Array of attributes to be applied to the ol tag.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>String containing the correctly formated list.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>/* returns
&lt;ol id="todo" class="pending"&gt;
	&lt;li&gt;red&lt;/li&gt;
	&lt;li&gt;blue&lt;/li&gt;
	&lt;li&gt;green&lt;/li&gt;
	&lt;li&gt;yellow&lt;/li&gt;
&lt;/ol&gt;
*/
$items = array('red', 'blue', 'green', 'yellow');
$attr = array('id' => 'todo','class' => 'pending');
echo Html::ol($items, $attr);

/* returns
&lt;ol class="order"&gt;
	&lt;li&gt;colors
		&lt;ol&gt;
			&lt;li&gt;blue&lt;/li&gt;
			&lt;li&gt;red&lt;/li&gt;
			&lt;li&gt;green&lt;/li&gt;
		&lt;/ol&gt;
	&lt;/li&gt;
	&lt;li&gt;sky&lt;/li&gt;
	&lt;li&gt;tools
		&lt;ol&gt;
			&lt;li&gt;screwdriver&lt;/li&gt;
			&lt;li&gt;hammer&lt;/li&gt;
		&lt;/ol&gt;
	&lt;/li&gt;
&lt;/ol&gt;
*/
$items = array(
	'colors' => array('blue', 'red', 'green'),
	'sky',
	'tools' => array('screw driver','hammer'));
$attr = array('class' => 'order');
echo Html::ol($items, $attr);</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<h3 id="procedural_helpers">Procedural helpers</h3>

			<article>
				<h4 id="function_html_tag">html_tag($tag, $attr = array(), $content = false)</h4>
				<p>The <strong>html_tag</strong> function generates an HTML tag based on the attributes provided..</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$tag</kbd></th>
									<td><em>string</em></td>
									<td><em>required</em></td>
									<td>the value to search for</td>
								</tr>
								<tr>
									<th><kbd>$attr</kbd></th>
									<td><em>array</em></td>
									<td><pre class="php"><code>array()</code></pre></td>
									<td>array of attributes</td>
								</tr>
								<tr>
									<th><kbd>$content</kbd></th>
									<td><em>string</em></td>
									<td><pre class="php"><code>false</code></pre></td>
									<td>the content wrapped in the tag</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>string</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>echo html_tag('a', array(
	'href' => 'http://somedomain.com/',
	'class' => 'my_class'
), 'Link title');

// &lt;a href="http://somedomain.com/" class="my_class"&gt;Link title&lt;/a&gt;</code></pre>

						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="function_array_to_attr">array_to_attr($attr)</h4>
				<p>The <strong>array_to_attr</strong> function generates an attributes string.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$attr</kbd></th>
									<td><em>array</em></td>
									<td><em>required</em></td>
									<td>an array of attributes</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>string</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>echo array_to_attr(array(
	'href' => 'http://somedomain.com/',
	'class' => 'my_class'
));

// href="http://somedomain.com/" class="my_class"</code></pre>

						</td>
					</tr>
					</tbody>
				</table>
			</article>

		</div>

		<footer>
			<p>
				&copy; FuelPHP Development Team 2010-2013 - <a href="http://fuelphp.com">FuelPHP</a> is released under the MIT license.
			</p>
		</footer>
	</div>
</body>
</html>
